﻿using System;
using Portal.Models.SkillsCatalog;
using Portal.Model;
using AutoMapper;
using Portal.Logic.Services.SkillsCatalog;

namespace Portal.Logic.Providers.SkillsCatalog
{
	/// <summary>
	/// Class <see cref="CurriculumVitaeProvider"/> define CV preview provider
	/// </summary>
	public class CurriculumVitaeProvider : ICurriculumVitaeProvider
	{
		#region Fields
		private readonly ICurriculumVitaeService _service;
		#endregion Fields

		#region .ctor

		/// <summary>
		/// Initializes a new instance of the <see cref="CurriculumVitaeProvider"/> class.
		/// </summary>
		/// <param name="service">The service.</param>
		/// <exception cref="System.ArgumentNullException">security</exception>
		public CurriculumVitaeProvider(ICurriculumVitaeService service)
		{
			if (service == null)
			{
				throw new ArgumentNullException("service");
			}
			_service = service;
		}

		#endregion .ctor

		#region Methods

		/// <summary>
		/// Gets the cv preview by the user.
		/// </summary>
		/// <param name="user">The user.</param>
		/// <returns>
		/// CV preview
		/// </returns>
		public ICurriculumVitaePreview GetPreviewBy(IUser user)
		{
			var cv = _service.GetBy(user);
			if (cv == null)
			{
				return null;
			}
			////var preview = new CurriculumVitaePreview();
			//preview.IsCVUpToDate = _service.IsUpToDate(cv, DateTime.Now);
			//preview.Background = cv.Background;

			//preview.Employers = cv.Employers.Map;

			return null;
		}

		#endregion Methods
	}
}